package com.powernode.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.powernode.domain.SysMenu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;

import java.util.List;

@Mapper
public interface SysMenuMapper extends BaseMapper<SysMenu> {
    @Select("SELECT DISTINCT t1.* FROM sys_menu t1 JOIN sys_role_menu t2 JOIN sys_user_role t3\n" +
            "\n" +
            "ON (t1.menu_id = t2.menu_id AND t2.role_id = t3.role_id)\n" +
            "\n" +
            "WHERE t3.user_id = #{userId}  AND (t1.type = 0 OR t1.type = 1)")
    List<SysMenu> selectUserMenuList(String userId);

}